<?php


namespace support;


use Throwable;

class ExceptionHandle
{

    // 找到你的项目所配置的异常处理类，本示例为
        // support/ExceptionHandle.php
    public function render(Request $request, Throwable $exception): Response
    {
        // Apidoc异常处理响应
        if ($exception instanceof \hg\apidoc\exception\HttpException) {
            return response(json_encode([
                "code" => $exception->getCode(),
                "message" => $exception->getMessage(),
            ],JSON_UNESCAPED_UNICODE), $exception->getStatusCode());
        }
        return parent::render($request, $exception);
    }

}